package com.tdam2014.grupo3;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Window;

import com.tdam2014.grupo3.entities.Photo;
import com.tdam2014.grupo3.interfaces.PhotoSelectionListener;

public class PhotoActivity extends Activity implements PhotoSelectionListener {
	
	private PhotoFragment photoFragment;
	public static final String KEY_PHOTO_ID = "photoID";

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
		setContentView(R.layout.activity_photo);
		
		photoFragment = (PhotoFragment) getFragmentManager().findFragmentById(R.id.photoFragment);
		photoFragment.setPhotoSelectionListener(this);
		
		getActionBar().setDisplayHomeAsUpEnabled(true);
	}

	@Override
	public void onPhotoSelected(Photo photo) {
		Intent intent = new Intent(this, CommentActivity.class);
		intent.putExtra(KEY_PHOTO_ID, photo.getId());
		startActivity(intent);
	}
}
